package com.splashscreen

import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.module.annotations.ReactModule
import com.splashscreen.SplashScreen.hide
import com.splashscreen.SplashScreen.show

@ReactModule(name = SplashScreenModule.NAME)
class SplashScreenModule(reactContext: ReactApplicationContext?) :
    ReactContextBaseJavaModule(reactContext) {
    override fun getName(): String {
        return NAME
    }

    /**
     * 打开启动屏
     */
    @ReactMethod
    fun show() {
        show(currentActivity)
    }

    /**
     * 关闭启动屏
     */
    @ReactMethod
    fun hide() {
        hide(currentActivity)
    }

    companion object {
        const val NAME = "SplashScreen"
    }
}
